package sctu.edu.java.year2016.team08.zengshenjing.day20160521.chapter4_2;

/**
 * Created by Administrator on 2016/5/21.
 * 用FOR循环打印菱形
 */
public class Work4_2 {
    public static void main(String[] args) {
        int i, j;
        for (j = 0; j < 5; j++)
            switch (j ) {
                case  0:
                for (i = 0; i < 5; i++){

                    if (i % 2 == 1)

                        System.out.print("\t");
                    else
                        if (i == 0 || i == 4)
                        System.out.print("\t");
                        else
                        System.out.print("\t *\t");}
                    System.out.println("");
                    break;

                case 1:
                for (i = 0; i < 5; i++){

                        if (i % 2 == 0)
                            System.out.print("\t");
                        else
                            System.out.print("\t*\t");}
                System.out.println("");
                break;
                case 2:
                for (i = 0; i < 5; i++){

                    if (i % 2 == 1)

                        System.out.print("\t");
                    else
                        if (i == 2)
                                System.out.print("\t");
                        else
                                System.out.print("\t*\t");

                    }
                System.out.println("");
                break;
                case 3:
                    for (i = 0; i < 5; i++){

                        if (i % 2 == 0)
                            System.out.print("\t");
                        else
                            System.out.print("\t*\t");}
                    System.out.println("");
                    break;
                case  4:
                    for (i = 0; i < 5; i++){

                        if (i % 2 == 1)

                            System.out.print("\t");
                        else
                        if (i == 0 || i == 4)
                            System.out.print("\t");
                        else
                            System.out.print("\t *\t");}
                    System.out.println("");
                    break;
            }
    }
    }

